package com.definity.toolkit.ui.widget;

import java.awt.Color;
import java.awt.Component;

import com.definity.toolkit.ToolkitRuntimeException;
import com.definity.toolkit.ui.Body;
import com.definity.toolkit.ui.widget.border.ShadowBorder;

public class ShadowPanel extends BorderPanel {

	private static final long serialVersionUID = -4792044967491422118L;

	private final WidgetBuilder b = new WidgetBuilder();

	private BorderPanel contentPanel;
	private ShadowBorder shadowBorder;
	
	public ShadowPanel() {
		opaque(false);
		
		contentPanel = b.borderPanel();
		center(contentPanel);
		
		shadowBorder = new ShadowBorder();
		border(shadowBorder);
	}
	
	public ShadowPanel content(Body<BorderPanel> body) {
		body.content(contentPanel);
		return this;
	}
	
	public Color shadowColor() {
		return shadowBorder.getColor();
	}
	
	public ShadowPanel shadowColor(Color borderColor) {
		shadowBorder.setColor(borderColor);
		return this;
	}

	public float shadowAlpha() {
		return shadowBorder.getAlpha();
	}
	
	public ShadowPanel shadowAlpha(float alpha) {
		shadowBorder.setAlpha(alpha);
		return this;
	}
	
	@Override
	public ShadowPanel add(Component c) {
		throw new ToolkitRuntimeException("Use content method");
	}
	
}
